(deftemplate rute
    (slot pornire)
    (slot destinatie)
    (slot distanta))
(assert(rute(pornire NewYork)(destinatie Toronto)(distanta 770)))
(assert(rute(pornire NewYork)(destinatie Chicago)(distanta 1150)))
(assert(rute(pornire NewYork)(destinatie Denver)(distanta 2600)))
(assert(rute(pornire Toronto)(destinatie Chicago)(distanta 700)))
(assert(rute(pornire Toronto)(destinatie LA)(distanta 3500)))
(assert(rute(pornire Toronto)(destinatie Vancouver)(distanta 3360)))
(assert(rute(pornire Chicago)(destinatie Denver)(distanta 1500)))
(assert(rute(pornire Denver)(destinatie LA)(distanta 1340)))
(assert(rute(pornire Denver)(destinatie Houston)(distanta 1410)))
(assert(rute(pornire Denver)(destinatie Memphis)(distanta 1410)))
(assert(rute(pornire Houston)(destinatie LA)(distanta 2200)))

(defrule fromNewYork
    (rute(pornire NewYork)(destinatie ?dest)(distanta ?dist))
    =>
    (printout t "ruta New York - "?dest" este de "?dist" km" crlf)
    )
(defrule intre
    (rute(pornire ?p)(destinatie ?dest)(distanta ?dist & :(< ?dist 2200)&:(> ?dist 800)))
    =>
    (printout t "ruta "?p"-"?dest" este de "?dist" km" crlf)
    )
(run)
